home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr47 / shwtxt16.zip / DPTHCHG.ST < prev    next >
Text File  |  1995-03-07  |  2KB  |  48 lines

  1. 'DPTHCHG.ST - Depth Charge Game
  2. on intkey0 esc goto quit
  3. 'v0         = ship timer ────┐
  4. 'v1  to v5  = sub timer      ├─timer value and speed are inversely proportional
  5. 'v6  to v10 = charge timer ──┘
  6. 'v11        = ship column
  7. 'v12 to v16 = sub column  {row is determined by: ((sub#)*2)+14 }
  8. 'v17 to v21 = charge row
  9. 'v22 to v26 = charge column
  10. 'v27 to v31 = charge maximum depth (currently always set to 24)
  11. cls\nochk\copy(dpthchg1,1)\copy(dpthchg2,2)
  12. :start copy(1,0)\bfill0(7,16,7,20)ascii32\%h=0\%m=0\%c=20\rst ts
  13. v0=16\v11=81\for %i=1 to 5\v%i=[rnd1to10]\v(%i+11)=[rnd1to16]\next
  14. for %i=6 to 10\v%i=12\v(%i+11)=0\v(%i+16)=0\v(%i+21)=24\next
  15. :chkin\waitkey 0\if key r then gosub rules\rst ts\goto chkin
  16. if key q quit\if %c>0 chkin1 
  17. for %i=17 to 21\if v%i>0 chktmr\next %i\window(11,30,15,51)100,[fb:15:2]
  18. p@12,36\p-\!"GAME  OVER"\p@14,33\!"PLAY AGAIN ?  /"\p+
  19. color 30,2\p@14,46\!"Y";\p@14,48\!"N";
  20. :play\waitkey\if key y start\if key n quit\goto play 
  21. :chkin1\if key null chktmr\%shc=85-v11\for %i=22 to 26\if v%i=%shc chktmr\next
  22. for %i=17 to 21\if v%i<>0 then gonext
  23. v%i=4\v(%i+5)=%shc\poke0(v%i,v(%i+5))22 28
  24. color 4,7\%c--\p@25,55\!%c,2zq;\goto chktmr\next
  25. :chktmr\for %t=0 to 10\if [tm:v%t:%t:255] action\next\goto chkin
  26. :action\rst t%t\select case %t
  27. case 0\v11--\if v11=7 then v11=81
  28. bcopy1to0(2,v11,2,v11+79)(3,1)
  29. case 1 to 5\%tn=%t+11\v%tn++\if v%tn>100 then v%tn=[rnd1to16]\v%t=[rnd1to10]
  30. %sr=(%t*2)+14\bcopy1to0(6,v%tn,6,v%tn+79)(%sr,1)
  31. for %i=17 to 21\if v%i<>0 then poke0(v%i,v(%i+5))22 28
  32. next\if not [ir:17:v%tn:96] subx\%sc=(97-v%tn)
  33. for %i=17 to 21\if v%i<>%sr or v(%i+5)<>%sc then gonext
  34. poke0(v%i,v(%i+5))15 28\gosub boom\bfill0(%sr,1,%sr,80)32 23
  35. v%i=0\v(%i+5)=0\v(%i+10)=24\v%tn=[rnd1to16]\v%t=[rnd1to10]\goto subx\next\:subx
  36. case 6 to 10\%tr=%t+11\if v%tr=0 chgx\%tc=%t+16\%tm=%t+21
  37. poke0(v%tr,v%tc)32 23\if v%tr=v%tm then color 4,7\%m++\p@25,42\!%m,2zq\goto chgr
  38. v%tr++\if [as:0:v%tr:v%tc]=32 then poke0(v%tr,v%tc)22 28\goto chgx
  39. poke0(v%tr,v%tc)15 28\gosub boom\bfill0(v%tr,1,v%tr,80)32 23
  40. %sn=(v%tr-14)/2\v%sn=[rnd1to10]\v(%sn+11)=[rnd1to16]
  41. :chgr\v%tr=0\v%tc=0\v%tm=24\:chgx
  42. end select\goto chkin
  43. :boom\for %j=1 to 6\bxor0(1,1,25,80)255\wait.06\next
  44. color4,7\%h++\p@25,30\!%h,2zq\ret
  45. :rules\save\copy(2,0)59\waitkey\restore60\ret
  46. :quit \ exitc
  47.  
  48.